<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SSE Demo</title>
</head>
<body>
<h1>SSE Demo</h1>
<div id="events"></div>

<script>
    const eventSource = new EventSource('http://127.0.0.1:18080/system/notice/sse');

    eventSource.onmessage = function(event) {
        const newElement = document.createElement("div");
        newElement.innerHTML = "Received: " + event.data;
        document.getElementById("events").appendChild(newElement);
    };

    eventSource.onerror = function(err) {
        console.error("EventSource failed:", err);
        eventSource.close();
    };
</script>
</body>
</html>
